#include "ctrl.h"


uint16_t tim1clk=0; //0~999


extern float Roll,Pitch,Yaw;
extern uint8_t mode;

float theta=0;

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
	if(htim==&htim1) // 1kHz  NO-LOOGER THAN 1 MS
	{
		tim1clk++;
		tim1clk%=1000;
		if(tim1clk%1==0) //1kHz
		{
		  theta=Roll+180;
	
		}
		if(tim1clk%10==1) //100Hz
		{ 

		}
		if(tim1clk%20==1) //50Hz
		{ 
			Update_Motor_Status();
		    Update_Expect_Location();
            Update_Motor_Location();
		}
		if(tim1clk%20==1) //50Hz
		{
			OLED_ShowNum(64,0,(int)(theta),3,16);
		}
		if(tim1clk%100==1) //10Hz
		{

		}
		if(tim1clk%200==1)
		{
						
		}
	}
	
}






